package com.shundr.frame.service;

import java.util.Set;

import android.content.Context;
import android.util.Log;
import cn.jpush.android.api.JPushInterface;
import cn.jpush.android.api.TagAliasCallback;

public class PusherManager {

	private static final String tag = "PusherManager";
	private Context mContext;
//	private static final String PUSH_CONFIG = "anonymity";

	/**
	 * @param context
	 */
	public PusherManager(Context context) {
		this.mContext = context;
	}

	public void setAlias(TagAliasCallback callback, String alias) {
		if (callback == null){
			JPushInterface.setAliasAndTags(mContext, alias, null,mTagAliasCallback);
		}else{
			JPushInterface.setAliasAndTags(mContext, alias, null, callback);
		}
	}

	public void setTags(TagAliasCallback callback, Set<String> tags) {
		if (callback == null){
			JPushInterface.setAliasAndTags(mContext, null, tags,mTagAliasCallback);
		}else{
			JPushInterface.setAliasAndTags(mContext, null, tags, callback);
		}
	}

	private TagAliasCallback mTagAliasCallback = new TagAliasCallback() {

		@Override
		public void gotResult(int arg0, String arg1, Set<String> arg2) {
			Log.i(tag, arg0 + " " + arg1);
		}
	};

}
